Add bulkFetch and documentClassCounts API functions#55
Merged
stevevanhooser merged 3 commits intomainfrom Apr 21, 2026
Merged
Conversation
Mirrors two new commands added to the MATLAB +ndi/+cloud/+api/+documents
namespace. MATLAB routes them through +implementation wrappers that
normalize output style; the Python port uses CloudClient for the same
role, so no +implementation mirror is needed.
INTERFACE UPDATE: Added bulkFetch and documentClassCounts entries to
src/ndi/cloud/api/ndi_matlab_python_bridge.yaml.
- bulkFetch: POST /datasets/{datasetId}/documents/bulk-fetch; mirrors
MATLAB input validation (non-empty, <= 500 entries, 24-char hex IDs)
and returns the 'documents' array.
- documentClassCounts: GET /datasets/{datasetId}/document-class-counts;
returns the datasetId/totalDocuments/classCounts struct.
The cloud search API no longer exposes document_class.class_name as a
directly searchable field path. Class filtering now has to go through
the 'isa' operator, which also rolls up subclasses. This was causing
test_ndiqueryAll_paginates to return zero documents against the live
server.
Only the two cloud ndiquery tests are affected. Inline document bodies
(e.g. {"document_class": {"class_name": "..."}}) and local
session.database_search calls continue to use the field directly since
they are not cloud search structures.
Replaces the regex-on-document_class.class_name idiom with the
semantic equivalent ndi_query.all(), which is a static factory for
isa('base'). Matches the NDI-matlab ndi.query.all() convention and
avoids relying on the soon-to-be-removed document_class field path.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Add two new document API functions to support efficient bulk document retrieval and document class histogram queries.
Key Changes
bulkFetch(): New function to synchronously fetch up to 500 documents by ID via POST/datasets/{datasetId}/documents/bulk-fetchndiqueryresults)documentClassCounts(): New function to retrieve document class histogram via GET/datasets/{datasetId}/document-class-countsdata.document_class.class_namedatasetId,totalDocuments, andclassCountsmapping'unknown'Input validation: Added regex pattern
_HEX24to validate 24-character hex document IDsComprehensive test coverage: Added 8 unit tests covering happy paths, validation errors, and edge cases
MATLAB bridge documentation: Updated sync metadata tracking both functions as synchronized with MATLAB main as of 2026-04-20
Implementation Details
@_auto_clientand@validate_calldecorators for consistency with existing API wrappersdocumentsfield inbulkFetchby returning empty listhttps://claude.ai/code/session_01Wv5mG4qAT66WtQ2NjMQP88